const project = {
  state: {
    // 侧边栏
    sidebar: {
      isOpen: true, // 是否展开侧栏
      withoutAnimation: false, // 动画效果
      isHide: false // 是否隐藏侧栏
    },
    hasNavTab: false // 是否开启页签
    
  },
  getters: {
    sidebar: (state) => state.sidebar,
    collapse: (state) => state.sidebar?.isOpen,
    withoutAnimation: (state) => state.sidebar?.withoutAnimation,
    isHide: (state) => state.sidebar?.isHide,
    getHasNavTab: (state) => state.hasNavTab
  },
  mutations: {
    // 切换侧栏
    SIDEBAR_IS_OPEN: (state) => {
      state.sidebar.isOpen = !state.sidebar.isOpen
    },
    // 侧栏隐藏
    SIDEBAR_IS_HIDE: (state, visible) => {
      state.sidebar.isHide = visible
    }
  },
  actions: {
    // 切换侧栏
    switchSideBarIsOpen({ commit }) {
      commit('SIDEBAR_IS_OPEN')
    },

    //  侧栏隐藏
    switchSideBarIsHide({ commit }, visible) {
      commit('SIDEBAR_IS_HIDE', visible)
    }
  }
}

export default {namespaced: true,...project}
